<template>
    <div class="glance">
        <van-nav-bar title="浏览记录" left-text="返回" left-arrow @click-left="pathGo" />
        <van-empty description="暂无浏览记录" v-show="flat" />
        <div class="glanceList">
            <myConTab v-for="item in glanceListArr" :num="item['num']" :uid="item['uid']" :key="item['uid']"></myConTab>
        </div>
    </div>
</template>

<script>
import myConTab from "@/components/myConTab.vue";
export default {
    name: "glance",
    data() {
        return {
            glanceListArr: [],
            flat: true,
        };
    },
    components: {
        myConTab,
    },
    methods: {
        pathGo() {
            this.$router.go(-1);
        },
        getGlance() {
            if (localStorage.getItem("record")) {
                let username = JSON.parse(localStorage.getItem("loginUser")).username;
                let scList = JSON.parse(localStorage.getItem("record")).filter((item) => {
                    return item["yyid"] == username;
                });
                this.glanceListArr = scList;
                if (this.glanceListArr.length != 0) {
                    this.flat = false;
                }
            } else {
                this.flat = true;
            }
        },
    },
    created() {
        this.getGlance();
    },
};
</script>

<style lang="scss" scope>
@import url(../../static/style/reset.css);
@import "../../static/style/variable.scss";
.van-nav-bar__text {
    color: #fdcbf1;
}

.van-nav-bar .van-icon {
    color: #fdcbf1 !important;
}
.glanceList {
    font-size: 0.4267rem;
    margin: 0.2667rem;
}
.glance {
    padding-bottom: 1.3333rem;
}
</style>
